define(['egis'],
    function (egis) {
        Window.deserializer = Window.deserializer || new egis.core.Deserializer();
        Window.container = Window.container || {};
        dsBridge.register('create_SelectFeatureTool', function (sourceId, commandId) {
            var selectFeatureTool = new egis.interact.SelectFeatureTool({id: commandId});
            selectFeatureTool.onSelectFeature = function (layer, feature) {
                //dsBridge.call("onSelectFeature", [layer.id, JSON.stringify(feature)]);
                dsBridge.call("egis.SelectFeatureTool_onSelectFeature", [sourceId,layer.id, JSON.stringify(feature)]);
            }

            selectFeatureTool.onUnSelectFeature = function () {
               // dsBridge.call("onUnSelectFeature", [null]);
               dsBridge.call("egis.SelectFeatureTool_onUnSelectFeature", [sourceId,null]);
            }
            Window.container[sourceId] = selectFeatureTool;
        });

        dsBridge.register('SelectFeatureTool_onClick', function (sourceId, param) {
            try {
                var selectFeatureTool = Window.container[sourceId];
                if (!!selectFeatureTool) {
                    selectFeatureTool.onClick(param);
                }
            }
            catch (e) {
                alert(e)
            }
        });
    })